<!DOCTYPE html>
<html ng-app="myApp">

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../css/reset.css">
		<link rel="stylesheet" href="../css/nav.css">
		<link rel="stylesheet" href="../css/foot.css">
		<link rel="stylesheet" type="text/css" href="../css/tankang.css" />
		<link rel="stylesheet" type="text/css" href="../css/tongcheng.css" />
		<!--<style type="text/css">
			.tankuang {
				position: absolute;
				left: 0;
				top: 0;
				width: 0;
				height: 0;
				display: none;
				/*display: block;*/
				z-index: 999;
			}
		</style>-->
		<script src="../js/angular.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/angular-route.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/jquery-3.0.0.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/jishi.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/fadajing.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div class="gouwutc" ng-include="'goushoptanchuang.html'"></div>
		<!--导航栏-->
		<div ng-include="'nav.html'"></div>

		<div ng-view></div>

		<div ng-include="'foot.html'"></div>

		<!--底部-->
	</body>
	<script type="text/javascript">
		var app = angular.module('myApp', ['ngRoute']);
		var gj;
		app.controller('libaiwu', function($scope) {

			$('.leftf1').mousemove(function(e) {

				var event = window.event || e;
				console.log(1)
				$('.mengban1').css({
					display: 'block'
				});

				$('.rightf1').css({
					display: 'block'
				});
				//获取鼠标在small中的位置 (也就是为了设置areaDiv的left top 值)
				var x = event.clientX - $('.leftf1').offset().left - $('.mengban1').width() / 2;
				var y = event.clientY - $('.leftf1').offset().top - $('.mengban1').height() / 2;

				var maxX = $('.leftf1').width() - $('.mengban1').width(); //滑块移动x轴的最大值
				var maxY = $('.leftf1').height() - $('.mengban1').height(); //滑块移动y轴的最大值

				console.log(x);
				console.log(y);
				console.log(xr);
				console.log(yr);
				console.log(maxX);
				console.log(maxY);
				//为了不让滑块出small的范围,合理的设置左边距和上边距的值
				if(x < 0) { //左侧超出
					x = 0;
				}
				if(x > maxX) { //右侧超出
					x = maxX
				}
				if(y < 0) { //上侧超出
					y = 0
				}
				if(y > maxY) { //下侧超出
					y = maxY
				}

				$('.mengban1').css({
					left: x,
					top: y
				});
				var xr = -($('.rightf1>img').width() - $('.rightf1').width()) * (x / maxX)
				var yr = -($('.rightf1>img').height() - $('.rightf1').height()) * (y / maxY)
				$('.rightf1>img').css({
					left: xr,
					top: yr
				})

			});

			$('.leftf1').mouseleave(function() {
				$('.rightf1').css({
					display: 'none'
				});

				$('.mengban1').css({
					display: 'none'
				})
			});
			var lef = 0
			$('.left2a1>img').click(function() {
				console.log('向左')
				lef -= 60;
				if(lef <= -400) {
					lef = -400
				}
				$('.lunbos31').animate({
					left: lef
				}, 200);

			});

			$('.rightf12a1>img').click(function() {
				console.log('向右');
				lef += 60;
				if(lef >= 0) {
					lef = 0
				}
				$('.lunbos31').animate({
					left: lef
				}, 200);

			});

			$('.lunbos31>li>img').click(function() {

				var srcc = this.getAttribute('ms');
				console.log(srcc)
				$('.leftf1>img').attr({
					src: srcc
				});
				$('.rightf1>img').attr({
					src: srcc
				});

				$('.lunbos31>li>img').css({
					border: '1px solid white'
				})
				$(this).css({
					border: '1px solid red'
				})

			});
			$('.zuo').click(function  () {
		
		$('.you1').css({
		display: 'none'
		});
		$('.zuo1').css({
			
			display: 'block'
		});
	});
	$('.you').click(function  () {
		
		$('.you1').css({
			display: 'block'
		});
		$('.zuo1').css({
			display: 'none'
		});
	});
$('.bbor').click(function  () {
	$('.bbor').css({
					backgroundColor: 'white',
					border:'1px solid darkgray'
				});
				$(this).css({
					backgroundColor: '#f4fff2',
					border:'1px solid green'
				});
});
var vas= $('.vas').val()
$('.jian1').click(function  () {
if (vas==0) {
	return
};
	$('.vas').val(vas--);		
})
$('.jia1').click(function  () {
	$('.vas').val(vas++)
})

		})
		app.controller('shangjia111', function() {
			gj=0
			$('.contentb>li>img').click(function(event) {
				 return false;
				$('.gouwutc').fadeIn(1000);

				$(document.body).css({
					"overflow-x": "hidden",
					"overflow-y": "hidden"
				});
			});

			$('.nones').click(function() {
				$('.gouwutc').fadeOut(1500);
				$(document.body).css({
					"overflow-x": "auto",
					"overflow-y": "auto"
				});
			})
			$('.nones1').click(function() {
				$('.movetop').css({
					transform: 'rotate(3600deg)',
					transition: '1s'
				}).animate({
					top: -400,
					left: 800,
				}, 1000)
				
				gj++;
				$('.tjwupin').text(gj)
				$('.gouwutc').fadeOut(2000)
				$(document.body).css({
					"overflow-x": "auto",
					"overflow-y": "auto"
				});

				setTimeout(function() {
					$('.movetop').css({
						top: 390,
						left: 240,
						transform: 'rotate(0deg)',

					});
				}, 2000)
			});
			$('.leftf').mousemove(function(e) {
				var event = window.event || e;
				console.log(1)
				$('.mengban').css({
					display: 'block'
				});

				$('.rightf').css({
					display: 'block'
				});
				//获取鼠标在small中的位置 (也就是为了设置areaDiv的left top 值)
				var x = event.clientX - $('.leftf').offset().left - $('.mengban').width() / 2;
				var y = event.clientY - $('.leftf').offset().top - $('.mengban').height() / 2;

				var maxX = $('.leftf').width() - $('.mengban').width(); //滑块移动x轴的最大值
				var maxY = $('.leftf').height() - $('.mengban').height(); //滑块移动y轴的最大值

				console.log(x);
				console.log(y);
				console.log(xr);
				console.log(yr);
				console.log(maxX);
				console.log(maxY);
				//为了不让滑块出small的范围,合理的设置左边距和上边距的值
				if(x < 0) { //左侧超出
					x = 0;
				}
				if(x > maxX) { //右侧超出
					x = maxX
				}
				if(y < 0) { //上侧超出
					y = 0
				}
				if(y > maxY) { //下侧超出
					y = maxY
				}

				$('.mengban').css({
					left: x,
					top: y
				});
				var xr = -($('.rightf>img').width() - $('.rightf').width()) * (x / maxX)
				var yr = -($('.rightf>img').height() - $('.rightf').height()) * (y / maxY)
				$('.rightf>img').css({
					left: xr,
					top: yr
				})

			});

			$('.leftf').mouseleave(function() {
				$('.rightf').css({
					display: 'none'
				});

				$('.mengban').css({
					display: 'none'
				})
			})

			var lef = 0
			$('.left2a>img').click(function() {
				lef -= 60;
				if(lef <= -400) {
					lef = -400
				}
				$('.lunbos3').animate({
					left: lef
				}, 200);

			});

			$('.rightf2a>img').click(function() {
				lef += 60;
				if(lef >= 0) {
					lef = 0
				}
				$('.lunbos3').animate({
					left: lef
				}, 200);

			});

			$('.lunbos3>li>img').click(function() {

				var srcc = this.getAttribute('ms');
				console.log(srcc)
				$('.leftf>img').attr({
					src: srcc
				});
				$('.rightf>img').attr({
					src: srcc
				});

				$('.lunbos3>li>img').css({
					border: '1px solid white'
				})
				$(this).css({
					border: '1px solid red'
				})

			})

		})

		app.config(function($routeProvider) {
			$routeProvider.when('/', {
				templateUrl: 'content.html'
			});
			$routeProvider.when('/tongchengfuwu', {
				templateUrl: 'tongfuwu.html'
			});
			$routeProvider.when('/baozhang', {
				templateUrl: 'xianyoubaozhang.html'
			});
			$routeProvider.when('/shouye', {
				templateUrl: 'content.html'
			});
			$routeProvider.when('/jifenshangcheng', {
				templateUrl: 'jifenshangcheng.html'
			});
			$routeProvider.when('/pingguo', {
				templateUrl: 'shangpinfenlei.html'
			});
			$routeProvider.when('/five', {
				templateUrl: 'fridaydecripation.html'
			});
			$routeProvider.when('/shangjia111', {
				templateUrl: 'shangjia.html'
			});
		});
		var bubu = false;	
		app.controller('navctrl', function($scope) {
			$('.pleaselogin').html(localStorage.getItem("name"));
			//我的订单
			$('.ding1').click(function(){
				if (bubu) {
					window.location='personalcenter.html#/buy';
				}else{
					window.location='t-loadimg.html';
				};
				
			});
			//我的消息
			$('.ding2').click(function(){
				if (bubu) {
					window.location='personalcenter.html#/msg';
				}else{
					window.location='t-loadimg.html';
				};
				
			});	
			//我的商家
			$('.ding3').click(function(){
				if (bubu) {
					window.location='personalcenter.html#/store';
				}else{
					window.location='t-loadimg.html';
				};
				
			});
						
			$('.t-tui').click(function(){
				if (bubu){
					$('.pleaselogin').html('');
					$(this).html('请登录');
					bubu = false;
					
				}else{
					$(this).html('退出');
					window.location='t-loadimg.html';
					localStorage.clear()
					bubu = true;
				}	
			})
			
			
			$('.shopping').click(function(){
				if($('.pleaselogin').text()==''){
					window.location = 't-loadimg.html';
				}else {
					window.location = 't-shoping1.html'
				}
			})
			
			
			//	下拉
			function move() {
				$('.a').mouseenter(function() {
					$('.one').fadeIn();
				});
				$('.one>li').hover(function() {
					$(this).children('.two').fadeIn();
				}, function() {
					$(this).children('.two').fadeOut();
				})

				$('.one').mouseleave(function() {
					$('.one').fadeOut()
				})
			};

			function moveout() {
				$('.a').mouseleave(function() {
					$('.one').fadeOut();
				});
			}
			move();
			moveout()
				//	下拉结束

			$('.nav_bottom>li').click(function() {
				$(this).css({
					backgroundColor: '#f08200',

				});
				$(this).children().css({
					color: 'white',
					borderRight: '1px solid #F08200'

				});
				$(this).siblings('li').children().css({
					color: 'black',
					borderRight: '1px solid #e9e9e9'

				});
				$(this).siblings('li').css({
					backgroundColor: 'white',

				})
			})
			$('.nav_bottom>li').eq(0).unbind("click");

			$('.btns1').click(function() {
				window.location.href = 'sousuokong.html'
			})

		})
		app.controller('conss', function($scope, $interval) {
			var timer1;

			//添加计时器
			//			var widths = $('#content').width();
			//			console.log(widths+'宽');	//第N+1张图片
			$scope.numberImg = 0;

			function startMove() {
				clearInterval(timer1);
				timer1 = $interval(function() {
					$scope.numberImg++;

					console.log('首页' + $scope.numberImg);
					if($scope.numberImg > 3) {
						$('#content').animate({
							left: '0px'
						}, 1000);
						$scope.numberImg = 0;
					}
					$('#content').animate({
						left: -$scope.numberImg * +100 + '%'
					}, 1500);
					//			console.log(numberImg)
					$('#button>li').attr('class', 'unchoose').eq($scope.numberImg).attr('class', 'choose');
				}, 3000);
			}
			startMove();

			$('#button>li').mouseenter(function() {
				$('#content').stop(true, false);
				clearInterval(timer1);
				$scope.numberImg = $(this).index();
				$('#content').animate({
					left: -$scope.numberImg * +100 + '%'
				}, 2000);
				$('#button>li').attr('class', 'unchoose').eq($scope.numberImg).attr('class', 'choose');
			});
			$('#button>li').mouseleave(function() {
				//				clearInterval(timer1);
				$scope.numberImg = $(this).index();
				//				startMove();
			});

			$('.ro>li').click(function() {
				//	alert(1);
				$(this).css({
					backgroundColor: '#008000',
				});
				$(this).siblings().css({
					backgroundColor: 'gainsboro'
				});
				$('.contenta').animate({
					left: -$(this).index() * 1300 + 'px'
				}, 500);
			});
			$scope.$on('$destroy', function() {
				$interval.cancel(timer1);
			}); //在控制器里，添加$on函数

			//			弹出购物车

			$('.contentb>li>img').click(function() {
				$('.gouwutc').fadeIn(1000);

				$(document.body).css({
					"overflow-x": "hidden",
					"overflow-y": "hidden"
				});
				event.stopPropagation(); 
			});

			$('.nones').click(function() {
				$('.gouwutc').fadeOut(1500);
				$(document.body).css({
					"overflow-x": "auto",
					"overflow-y": "auto"
				});
			})
			$('.nones1').click(function() {
				$('.movetop').css({
					transform: 'rotate(3600deg)',
					transition: '1s'
				}).animate({
					top: -400,
					left: 800,
				}, 1000)
				gj++;
				$('.tjwupin').text(gj)
				$('.gouwutc').fadeOut(2000)
				$(document.body).css({
					"overflow-x": "auto",
					"overflow-y": "auto"
				});

				setTimeout(function() {
					$('.movetop').css({
						top: 390,
						left: 240,
						transform: 'rotate(0deg)',

					});
				}, 2000)
			});

			//商家详情
			$('.contentb>li').click(function(event) {
				
				 
				//			alert(1);
				var href = window.location.href;

				var hrefs = href.split('#');

				window.location.href = hrefs[0] + '#/shangjia111';
				
			});

		});
		app.controller('tongchneg', function($scope, $interval) {
			var timer;
			//添加计时器

			//第N+1张图片
			$scope.numberIm2 = 0;

			function startMove() {
				clearInterval(timer);
				timer = $interval(function() {
					$scope.numberIm2++;
					console.log('同城' + $scope.numberIm2);
					if($scope.numberIm2 > 3) {
						$('.content2').animate({
							left: '0px'
						}, 0);
						$scope.numberIm2 = 0;
					}
					$('.content2').animate({
						left: -$scope.numberIm2 * 100 + '%'
					}, 1500);
					//			console.log(numberImg)
					$('.button2>li').attr('class', 'unchoose').eq($scope.numberIm2).attr('class', 'choose');

				}, 3000);
			}
			startMove();

			$('.button2>li').mouseenter(function() {

				$('.content2').stop(true, false);
				clearInterval(timer);
				$scope.numberImg2 = $(this).index()
				$('.content2').animate({
					left: -$scope.numberIm2 * 100 + '%'
				}, 2000);
				$('.button2>li').attr('class', 'unchoose').eq($(this).index()).attr('class', 'choose');

			})

			$('.button2>li').mouseleave(function() {
				//				clearInterval(timer);
				$scope.numberIm2 = $(this).index();
				//				startMove();
			});

			$('.dzx>li').click(function() {
				$(this).css({
					border: '1px solid #008000'
				})
				$(this).siblings().css({
					border: '1px solid white'
				})
			})

			$scope.$on('$destroy', function() {
				$interval.cancel(timer);
			}); //在控制器里，添加$on函数
			$('.bianse').click(function  () {
				
				$('.bianse').css({
					backgroundColor: 'white'
				});
				$(this).css({
					backgroundColor: 'green'
				});
			})
			


		});
		app.controller('mysc', function($scope, $interval) {
			var timer;
			//添加计时器

			//第N+1张图片
			$scope.numberIm2 = 0;

			function startMove() {
				clearInterval(timer);
				timer = $interval(function() {
					$scope.numberIm2++;
					console.log('同城' + $scope.numberIm2);
					if($scope.numberIm2 > 3) {
						$('.content3').animate({
							left: '0px'
						}, 0);
						$scope.numberIm2 = 0;
					}
					$('.content3').animate({
						left: -$scope.numberIm2 * 100 + '%'
					}, 1500);
					//			console.log(numberImg)
					$('.button3>li').attr('class', 'unchoose').eq($scope.numberIm2).attr('class', 'choose');

				}, 3000);
			}
			startMove();

			$('.button3>li').mouseenter(function() {

				$('.content3').stop(true, false);
				clearInterval(timer);
				$scope.numberImg2 = $(this).index()
				$('.content3').animate({
					left: -$scope.numberIm2 * 100 + '%'
				}, 2000);
				$('.button3>li').attr('class', 'unchoose').eq($(this).index()).attr('class', 'choose');

			})

			$('.button3>li').mouseleave(function() {
				//				clearInterval(timer);
				$scope.numberIm2 = $(this).index();
				//				startMove();
			});

			$scope.$on('$destroy', function() {
				$interval.cancel(timer);
			}); //在控制器里，添加$on函数

		});
		app.controller('matc', function($scope) {
			$('.pspan1>span').click(function() {
				$('.pspan1>span').css({
					color: 'black',
					border: '1px solid gainsboro'
				})
				$(this).css({
					color: 'green	',
					border: '1px solid red'
				})
			});
			$('.pspan>span').click(function() {
				$('.pspan>span').css({
					color: 'black',
					border: '1px solid gainsboro'
				})
				$(this).css({
					color: 'green	',
					border: '1px solid red'
				});

			});
			var max1;
			$('.jia').click(function() {
				console.log('加加')
				max1 = $('.innum').val();
				max1++;
				$('.innum').val(max1);
			})
			$('.jian').click(function() {
				console.log('减减');

				max1 = $('.innum').val();
				max1--;
				if(max1 <= 0) {
					max1 = 0;
				}
				$('.innum').val(max1);
			})

		})

		function tangkuang() {
			$('.tankuang').css({
				display: 'block'
			})
			$('.tankuang').animate({
				left: '40%',
				top: '40%',
				width: '400px',
				height: '510px'

			}, 500)
		}
	</script>

</html>